package com.suptracking.web.servlet;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.suptracking.service.CarService;

/**
 * Servlet implementation class removeCarServlet
 */
@WebServlet("/RegisteredContent/removeCar")
public class removeCarServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	@EJB
	CarService carservice;
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		long id = Long.parseLong(request.getParameter("id2"));
		carservice.deleteCarbyId(id);
		response.sendRedirect(request.getServletContext().getContextPath()+"/RegisteredContent/ManageCar");
				}

}
